#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 2e5 + 10;

LL n, q, x;
LL w[N];
bool st[N];

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> q >> x;
    for(int i = 0; i < n; i ++) cin >> w[i];

    vector<LL> nums;
    st[0] = true;
    LL cur = 0, cnt = 0;
    bool flag = false;
    while(true){
        if(flag) break;
        for(int i = 0; i < n; i ++){
            if(cur + w[i] >= x){
                nums.push_back(cnt + 1);
                cnt = 0;
                cur = 0;
                if(st[i]){
                    flag = true;
                    break;
                }else{
                    // cout << "i: " << i << '\n';
                    st[i] = true;
                }

                
            }else{
                cnt ++;
                cur += w[i];
            }
        }
    }

    LL sz = nums.size();

    // for(int i = 0; i < sz; i ++){
    //     cout << nums[i] << " ";
    // }
    // cout << '\n';

    LL k;
    while(q--){
        cin >> k;
        // cout << "k: " << k << '\n'; 
        k = (k - 1) % sz;
        cout << nums[(int)k] << '\n';
    }


    return 0;
}